const express = require('express')
// 跨域中间件
const cors = require('cors');
const app = new express()

const { getNewsList,getNewsDetail } = require('./common');
app.use(cors())
app.get('/getNewsList', (request, response) => {
  response.send(JSON.stringify(getNewsList()))
})
app.get('/getNewsDetail/:id', (request, response) => {
  console.log(request.params.id)
  response.send(JSON.stringify(getNewsDetail(request.params.id)))
})
app.listen(80, (params) => {
  console.log('服务器启动了', "只有2个方法")
  console.log('', "只有2个方法")
})